class TodayGoal {
  int? id;
  String name;
  int userId;

  TodayGoal({
    this.id,
    required this.name,
    required this.userId,
  });

  Map<String, dynamic> toMap() {
    return {
      'id': id,
      'name': name,
      'userId': userId,
    };
  }

  factory TodayGoal.fromMap(Map<String, dynamic> map) {
    return TodayGoal(
      id: map['id'],
      name: map['name'],
      userId: map['userId'],
    );
  }

  TodayGoal copyWith({
    int? id,
    String? name,
    int? userId,
  }) {
    return TodayGoal(
      id: id ?? this.id,
      name: name ?? this.name,
      userId: userId ?? this.userId,
    );
  }

  @override
  String toString() {
    return 'TodayGoal{id: $id, name: $name, userId: $userId}';
  }

  @override
  bool operator ==(Object other) {
    if (identical(this, other)) return true;
    return other is TodayGoal &&
        other.id == id &&
        other.name == name &&
        other.userId == userId;
  }

  @override
  int get hashCode {
    return id.hashCode ^ name.hashCode ^ userId.hashCode;
  }
}
